//
//  YQIncubatorVC.m
//  NewRetail
//
//  Created by yuqin on 2019/6/24.
//  Copyright © 2019 yuqin. All rights reserved.
//

#import "YQIncubatorVC.h"
#import "YQIncubatorCell.h"
#import "YQIncubatorProjectVC.h"

@interface YQIncubatorVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *incubatorTB;
@property (nonatomic, strong) NSMutableArray *dataArr;

@end

@implementation YQIncubatorVC

- (NSMutableArray *)dataArr {
    if (!_dataArr) {
        _dataArr = [NSMutableArray array];
    }
    return _dataArr;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.txtTitle.text = @"孵化器";
    self.view.backgroundColor = UIColorFromRGB(0xeeeeee);
    [self setupIncubatorView];
    
    
}

- (void)setupIncubatorView {
    [self.view addSubview:self.incubatorTB];
    [self.incubatorTB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMargin_left);
        make.top.mas_equalTo(NavigationStatusBarHeight);
        make.size.mas_equalTo(CGSizeMake(ScreenWidth-FIT(32), ScreenHeight-NavigationStatusBarHeight));
    }];
}

- (UITableView *)incubatorTB {
    if (!_incubatorTB) {
        _incubatorTB = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _incubatorTB.delegate = self;
        _incubatorTB.dataSource = self;
        [_incubatorTB  setSeparatorStyle:UITableViewCellSeparatorStyleNone];
        [_incubatorTB registerNib:[UINib nibWithNibName:YQ_IncubatorCell bundle:nil] forCellReuseIdentifier:YQ_IncubatorCell];
    }
    return _incubatorTB;
}
#pragma mark - delegate/datasources

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return FIT(155);
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return section == 0?0: FIT(10);
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.0001;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    YQIncubatorCell *cell = [tableView dequeueReusableCellWithIdentifier:YQ_IncubatorCell forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    @weakify(self);
    cell.IncubatorSoonBlock = ^{
        @strongify(self);
        YQ_PUSH([YQIncubatorProjectVC new]);
    };
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return nil;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return nil;
}

@end
